package com.garlicts.framework.util;

import com.garlicts.framework.core.FrameworkConstant;
import com.garlicts.framework.config.PropertiesProvider;

import java.util.ArrayList;
import java.util.List;

public class ScanPackageUtil {

    /**
     * 获取基础包名
     */
    private static final String basePackage = PropertiesProvider.getString(FrameworkConstant.CUSTOM_SCAN_PACKAGE);


    /**
     * 获取扫描的package路径
     */
    public static List<String> getScanPackages(){

        List<String> packages = new ArrayList<>();
        packages.add(FrameworkConstant.FRAMEWORK_SCAN_PACKAGE);

        String[] packageArr = basePackage.split(",");
        for(int i=0; i<packageArr.length; i++){
            if(!packages.contains(packageArr[i])){
                packages.add(packageArr[i]);
            }
        }

        return packages;

    }

}
